<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>短信发送</title>
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  		<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
 		<link rel="stylesheet" href="../../layuiadmin/layui/css/layui.css" media="all">
  		<link rel="stylesheet" href="../../layuiadmin/style/admin.css" media="all">
  		<link rel="stylesheet" href="../../public/res/css/g.css" />
  		<style>
  			.layui-form-label{width: 90px;}
  			.layui-input-block{margin-left: 125px;}
  			.layui-upload-img{width: 420px;height: 92px;margin: 0 10px 10px 0;}
  			.layui-table-link{text-decoration: underline;}
  			.layui-table-link:hover{color:#e18806;}
  		</style>
	</head>
	<body>
		<div class="layui-fluid">
			<div class="layui-card">
				<div class="layui-card-body" style="padding: 15px;">
					<form class="layui-form" action="" lay-filter="component-form-group" style="padding: 10px 0 0 0;">
						<div class="layui-form-item">
								<div  class="layui-inline">
									<label class="layui-form-label">输入关键词</label>
								    <div class="layui-input-block">
						              <input type="text" name="key" lay-verify="key" autocomplete="off" placeholder="请输入关键词" class="layui-input">
						            </div>
								</div>
								<div  class="layui-inline">
									<label class="layui-form-label">标签</label>
								    <div class="layui-input-inline">
								       <input type="text" name="sign" lay-verify="sign" autocomplete="off" placeholder="请输入标签" class="layui-input">
								    </div>
								</div>
								<div  class="layui-inline">
									<button class="layui-btn"><i class="layui-icon">&#xe615;</i>查询</button>
								</div>
					    </div>
					</form>
					<hr>
					<div class="layui-btn-group demoTable" style="margin-bottom: 5px;">
						<button class="layui-btn layui-btn-primary"  lay-event="add"><i class="layui-icon">&#xe654;</i>新增</button>
					</div>
					<table class="layui-table" lay-data="{cellMinWidth: 80,height:472, url:'./data/msm.json', page:true, id:'idTest'}" lay-filter="demo">
					  <thead>
					    <tr>
					      <th lay-data="{type:'checkbox'}"></th>
					      <th lay-data="{field:'id', sort: true, width:100}">序号</th>
					      <th lay-data="{field:'sign',width:280}">标签</th>
					      <th lay-data="{field:'member'}">隶属人员</th>
					      <th lay-data="{fixed: 'right', width:180, align:'center', toolbar: '#barDemo'}">操作</th>
					    </tr>
					  </thead>
					</table>
					<script type="text/html" id="barDemo">
					  <a class="layui-btn  layui-btn-normal layui-btn-xs" lay-event="detail"><i class="layui-icon">&#xe63c;</i>详情</a>
					  <a class="layui-btn  layui-btn-danger layui-btn-xs" lay-event="delete"><i class="layui-icon">&#xe640;</i>删除</a>
					</script>
				</div>
			</div>
		</div>
		<script src="../../layuiadmin/layui/layui.js"></script>  
		<script>
			layui.use(['form','table','laydate','element'], function(){
			  var form = layui.form;
			  var table = layui.table;
			  var laydate = layui.laydate;
			  var $ = layui.jquery,element = layui.element;
			  
			  laydate.render({
			    elem: '#test6'
			    ,range: true
			  });
			  
			  //监听表格复选框选择
			  table.on('checkbox(demo)', function(obj){
			    console.log(obj)
			  });
			  //监听工具条
			  table.on('tool(demo)', function(obj){
			    var data = obj.data;
			    if(obj.event === 'detail'){
			      layer.msg('ID：'+ data.id + ' 的查看操作');
			    } else if(obj.event === 'del'){
			      layer.confirm('真的删除行么', function(index){
			        obj.del();
			        layer.close(index);
			      });
			    } else if(obj.event === 'edit'){
			      layer.alert('编辑行：<br>'+ JSON.stringify(data))
			    }
			  });
			  
			  var $ = layui.$, active = {
			    getCheckData: function(){ //获取选中数据
			      var checkStatus = table.checkStatus('idTest')
			      ,data = checkStatus.data;
			      layer.alert(JSON.stringify(data));
			    }
			    ,getCheckLength: function(){ //获取选中数目
			      var checkStatus = table.checkStatus('idTest')
			      ,data = checkStatus.data;
			      layer.msg('选中了：'+ data.length + ' 个');
			    }
			    ,isAll: function(){ //验证是否全选
			      var checkStatus = table.checkStatus('idTest');
			      layer.msg(checkStatus.isAll ? '全选': '未全选')
			    }
			  };
			  
			  $('.demoTable .layui-btn').on('click', function(){
			    var type = $(this).data('type');
			    active[type] ? active[type].call(this) : '';
			  });
			  
			  form.on('select(grade)', function(data){
				   if(data.value=='0'){
				   		$('[data-name="root"]').removeClass('layui-hide')
				   }else{
				   		$('[data-name="root"]').addClass('layui-hide')
				   }
				}); 
			  
			  $('[lay-event="add"]').on('click',function(){
					layer.open({
					  type: 2,
					  area: ['800px', '550px'],
					  fixed: false, //不固定
					  maxmin: true,
					  content: 'phoneuser-detail.html'
					});
			  })
			  
			});
		</script>
	</body>
</html>
